import 'package:bruno/bruno.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../AppConfig/Config.dart';
import '../../l10n/messages.dart';

class SureCancel extends StatefulWidget {
  const SureCancel({super.key});

  @override
  State<SureCancel> createState() => _SureCancelState();
}

class _SureCancelState extends State<SureCancel> {
  List items = ['需要解绑手机', '不做货主了', '修改手机号', '其他原因'];
  int selectedIndex = -1;
  String writeText="";
  @override
  Widget build(BuildContext context) {
    var messages = AppLocalizations.of(context)!;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text(messages['账户注销'],style: TextStyle(fontWeight: FontWeight.w300,fontSize: 16.sp),),
      ),
      body: ListView(
        children: [
          SizedBox(height: 8.h,),
          Container(
            height: 170.h,
            color: Colors.white,
            child:   ListView.builder(
              itemCount: items.length,

              itemBuilder: (context, index) {
                return Column(
                  children: [
                    ListTile(
                      title: Text(items[index]),
                      trailing: selectedIndex == index
                          ? Icon(Icons.check,color: MyColors.themeColor,)
                          : null,
                      onTap: () {
                        setState(() {
                          selectedIndex = index;
                        });
                      },
                    ),
                    Container(height: 1.h,color: MyColors.backgreyColor,),
                  ],
                );

              },
            ),
          ),
          Container(
            color: Colors.white,
            height: 140.h,
            child:Column(
              children: [
                SizedBox(height: 8.h,),
                Container(
                  height: 120.h,
                  margin: EdgeInsets.only(left: 8.w,right: 8.w),
                  child: BrnInputText(
                    maxHeight: 100,
                    minHeight: 100,
                    minLines: 1,
                    maxLength: 120,
                    bgColor: MyColors.backgreyColor!,
                    textString:writeText ?? '',
                    textInputAction: TextInputAction.newline,
                    // maxHintLines: 20,
                    hint: '其他原因',
                    padding: EdgeInsets.fromLTRB(20, 10, 20, 14),
                    onTextChange: (text) {
                      print(text);
                      writeText = text;
                      setState(() {});
                    },
                    onSubmit: (text) {
                      print(text);
                    },
                  ),
                )
              ],
            ),
          ),
          SizedBox(height: 50.h,),
          GestureDetector(
            child: Container(
              margin: EdgeInsets.only(left: 15.w,right: 15.w),
              height: 40.h,
              decoration: BoxDecoration(
                  color: MyColors.themeColor,
                  borderRadius: BorderRadius.all(Radius.circular(30))
              ),
              child: Center(

                child: Text("注销",style: TextStyle(color: Colors.white,fontSize: MyFontSizes.sixtyText.sp),),
              ),
            ),
            onTap: (){

            },
          ),
        ],
      ),


    );
  }
}
